Skip to content

refactoring(cli/tui): richlog visualizer#577

Merged
VascoSch92 merged 5 commits intomainfrom
vasco/refactor-rich-log
Mar 10, 2026
Merged

refactoring(cli/tui): richlog visualizer#577
VascoSch92 merged 5 commits intomainfrom
vasco/refactor-rich-log

Conversation

@VascoSch92
Copy link
Contributor

@VascoSch92 VascoSch92 commented Mar 7, 2026

What: Added _clean_and_truncate() that combines the repeated 3-step sequence:

strip + collapse newlines → truncate → escape Rich markup

into one call, replacing 8 inline occurrences in _extract_meaningful_title.

Why: The same 3-line pattern was copy-pasted for every event type branch, making the method 100 lines long and easy to
get subtly wrong (e.g., forgetting to escape or truncate in one branch). The helper makes each branch a one-liner and
ensures consistent processing everywhere.


🚀 Try this PR

uvx --python 3.12 git+https://github.com/OpenHands/OpenHands-CLI.git@vasco/refactor-rich-log

@VascoSch92 VascoSch92 requested a review from malhotra5 March 7, 2026 09:04
Copy link
Collaborator

@all-hands-bot all-hands-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taste Rating: 🟢 Good taste

This is textbook refactoring: eliminates 8 instances of copy-pasted logic, ensures consistency, and makes each branch a one-liner. The helper name is clear, and the from_start parameter is used sensibly (file paths show filename, not directory).

Why this is good:

  • Solves a real problem (maintenance burden + potential for subtle bugs)
  • Simplifies without adding complexity
  • No breaking changes (pure refactoring)

Verdict: ✅ Clean, pragmatic solution. Merge it.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2026

Coverage

Coverage Report •
FileStmtsMissCoverMissing
openhands_cli/tui/widgets
   richlog_visualizer.py3478475%70, 73, 77, 80–83, 85, 173, 180–181, 193, 238, 279, 361, 411–414, 427, 430–431, 434–435, 438, 440, 443, 477–481, 485, 492–495, 499, 511, 552, 557–558, 561–563, 566, 572–575, 577, 584, 598–599, 601, 607, 626–627, 630, 683, 686–687, 691, 701, 704, 721, 723–725, 729, 767–768, 783, 789, 810–811, 815–817, 827–828, 832–834
TOTAL663591786% 

@VascoSch92 VascoSch92 enabled auto-merge (squash) March 10, 2026 06:43
@VascoSch92 VascoSch92 merged commit 70b46ed into main Mar 10, 2026
11 checks passed
@VascoSch92 VascoSch92 deleted the vasco/refactor-rich-log branch March 10, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants